package com.ea.admin.mapper;

import com.ea.admin.pojo.po.DeptInfo;
import com.ea.common.mybatis.EmoAnalyBaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface DeptInfoMapper extends EmoAnalyBaseMapper<DeptInfo> {

    void deleteRelatedDeptByDeptId(
            @Param("deptId") Long deptId
    );

    /**
     * 根据部门id查询部门信息，包括被删除的部门
     */
    DeptInfo selectDeptInfoById(
            @Param("deptId") Long deptId
    );

    List<Long> getDepartmentIdList(
            @Param("accountId") Long accountId
    );

    /**
     * 根据部门id查询该部门树上的子部门，包括根节点
     */
    List<Long> getAllSubDeptIdByDeptId(
            @Param("deptIdList") List<Long> deptIdList
    );


    boolean checkIfDeptHasUser(
            @Param("deptIdList") List<Long> deptIdList
    );

    boolean checkIfDeptHasAdmin(
            @Param("deptIdList") List<Long> deptIdList
    );

    List<Long> getAllDeptId();

    Integer getTotalCount(
            @Param("deptIdList") List<Long> deptIdList);
    Integer getTotalFemaleCount(
            @Param("deptIdList") List<Long> deptIdList);

    List<Long> getAllByCompanyId(
            @Param("companyIdList") List<Long> companyIdList
    );

    void removeSupDeptId(
            @Param("deptId") Long deptId
    );
}
